package cn.com.shopec.erp.product.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import cn.com.shopec.erp.common.page.PageFinder;
import cn.com.shopec.erp.common.page.PageQuery;
import cn.com.shopec.erp.common.utils.JsonHelper2;
import cn.com.shopec.erp.product.entity.InventoryCheck;
import cn.com.shopec.erp.product.service.INventoryCheckService;
import cn.com.shopec.erp.purchase.entity.PurchaseRequisitionProduct;

@Controller
@RequestMapping("inventory/inventoryManger/")
public class InventoryCheckController {
	
	@Resource
	private INventoryCheckService  inventoryCheckService;
	
	/**
	 * 跳转库存盘点
	 * @param inventoryCheck
	 * @param modelMap
	 * @return
	 */
	@RequestMapping("/inventoryCheckList")
	public ModelAndView inventoryCheckList(InventoryCheck inventoryCheck,ModelMap modelMap){
		modelMap.put("inventoryCheck", inventoryCheck);
		return new ModelAndView("/warehourse/inventory_check");
	}
	
	/**
	 * 库存盘点记录
	 * @param purchaseOrderVo
	 * @param pageQuery
	 * @param modelMap
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/ajaxToinventoryCheckList")
	@ResponseBody
	public String ajaxToinventoryCheckList(InventoryCheck inventoryCheck, PageQuery pageQuery, ModelMap modelMap)
			throws Exception {
		PageFinder<InventoryCheck> pagedBrandList = this.inventoryCheckService.getPagedInventoryCheckList(inventoryCheck, pageQuery);
		modelMap.put("Rows", pagedBrandList.getData());
		modelMap.put("Total", pagedBrandList.getRowCount());
		return JsonHelper2.toJson(modelMap);
	}
	

}
